package org.bai.miaoshaproject.error;

/**
 * ClassName EmBusinessError
 *
 * @author Bai
 * @version 1.0
 * @date 2019/5/27 0027 下午 23:34
 **/
public enum EmBusinessError implements CommonError {

    /**
     * 通用错误类型
     */
    PARAMETER_VALIDATION_ERROR(10001, "参数错误"),
    /**
     * 未知错误
     */
    UNKNOWN_ERROR(10002, "未知错误"),
    /**
     * 用户不存在
     */
    USER_NOT_EXIST(20010, "用户不存在"),
    /**
     * 手机或密码不存在
     */
    USER_LOGIN_FAIL(20002,"手机或密码不存在"),
    /**
     * 用户还未登陆
     */
    USER_NOT_LOGIN(20003,"用户还未登陆"),
    /**
     * 库存不足
     */
    STOCK_NOT_ENOUGH(30001,"库存不足")
    ;

    private int errorCode;
    private String errorMsg;

    EmBusinessError(int errorCode, String errorMsg){
        this.errorCode = errorCode;
        this.errorMsg = errorMsg;
    }

    @Override
    public int getErrorCode() {
        return this.errorCode;
    }

    @Override
    public String getErrorMsg() {
        return this.errorMsg;
    }

    @Override
    public CommonError setErrorMsg(String errorMsg) {
        this.errorMsg = errorMsg;
        return this;
    }}
